export default class Toast {
  constructor(option) {
    this.constructor.context = option
  }

  static context = null

  static duration = 2000

  static text(options) {
    let { message = '', duration = 2000 } = options
    this.context.setData({
      show: true,
      message: message
    })
    this.duration = duration
    setTimeout(() => {
      this.clear()
    }, this.duration)
  }

  static clear() {
    this.context.setData({
      show: false,
      message: ''
    })
  }
}
